package twi.user;

public class Permissions {

	private boolean createInstances = false;
	private boolean deleteInstances = false;
	
	private boolean isAdmin = false;

	

	public Permissions( boolean createIn, boolean deleteIn, boolean isAdmin) {
		super();
		this.createInstances = createIn;
		this.deleteInstances = deleteIn;
		this.isAdmin = isAdmin;
	}

	
	public Permissions(byte[] b_mask) {
		if (b_mask[0] > 0)
			this.isAdmin = true;
		if (b_mask[1] > 0)
			this.createInstances = true;
		if (b_mask[2] > 0)
			this.deleteInstances = true;
	}


	public void setAdmin(boolean isAdmin, Permissions per) {
		if (per.isAdmin) {
			this.isAdmin = isAdmin;
			this.createInstances = isAdmin;
			this.deleteInstances = isAdmin;
		}
	}


	public boolean isCreateInstances() {
		return createInstances;
	}


	public boolean isDeleteInstances() {
		return deleteInstances;
	}


	public boolean isAdmin() {
		return isAdmin;
	}

}
